#ifndef GAMESESSION_H
#define GAMESESSION_H

#define INIT_SCORE 0
#define INIT_LIVES 3
#define LIFE_BONUS 50 // bonus for each extra life gained
#define TIME_BONUS 1  // bonus for each second surplus

typedef enum {
    ssPLAYING_QP,
    ssPLAYING_SM,
    ssPLAYING_BONUS,
    ssSUCCESSFUL,
    ssFAILED,
    ssQUIT
} SessionState;

/*
 * Stores the state of a player through the course of a game
 * whether it is the normal game or quickplay
 */
class GameSession
{
	private:
		int levelScore;
		int levelLives;
		int levelBonus;
		int gameLives;
	    int gameScore;
		float levelTimeLeft;
		SessionState currentState;
		bool highScoreAdded, replay;
        
	public:
		GameSession();
	   ~GameSession(void) {}
	    GameSession(const GameSession&);
	    void print();
	   
        // Initialisation and cleanup
        void beginQuickPlay();
        void endQuickPlay();
        void beginStoryModeLevel();
        void endStoryModeLevel(bool);
        void beginBonusRun();
        void endBonusRun();

        // Modifiers
        void  addScore(int);
        void  addLife(void);
        void  resetLevelScore(void);
        bool  removeLife(void);
        void  setTimeLeft(float);

        // Getters
        int   getLevelScore(void)          { return levelScore; }
        int   getLevelBonus(void)          { return levelBonus; }
        int   getGameScore(void)           { return gameScore; }
        int   getLevelLives(void)          { return levelLives; }
        int   getNumLives(void);
        float getTimeLeft(void)            { return levelTimeLeft; }
        int   getLifeBonus(void)           { return (levelLives * LIFE_BONUS > 0) ? levelLives * LIFE_BONUS : 0; }
        int   getTimeBonus(void)           { return levelTimeLeft * TIME_BONUS; }
		int	  getTotalLevelScore(void)	   { return levelBonus + levelScore; }

        // Session state
        void  setState(SessionState state) { currentState = state; }
        SessionState getState()            { return currentState; }
        void setHighScoreAdded()           { highScoreAdded = true; }
        void resetHighScoreAdded()         { highScoreAdded = false; }
        bool hasAddedHighScore()           { return highScoreAdded; }
        void setReplay(bool replay_)       { replay = replay_; }
};

#endif

